import java.io.*;

public class LineCounter {

    public static void main(String args[]) throws IOException{
        String dirname = "..\\";
        File dir = new File(dirname); 
        String[] children = dir.list(); 
        if (children == null) {
    
        } else { 
        	int totalLinesOfCode = 0;
            for (int i=0; i<children.length; i++) { 
                // Get filename of file or directory 
                String filename = children[i]; 
               
                if (!filename.startsWith(".") && ( filename.endsWith(".cpp") || filename.endsWith(".h") ))
                {
                	LineNumberReader a = new LineNumberReader(new FileReader(dirname+filename));
                	
                	int k=0;
                	while ((a.readLine()) != null) {
                    	k++;
                	}   
                	System.out.println(filename +" "+ k);
              		totalLinesOfCode += k;
              	}
              	
            }            
            System.out.println("-----------------------------------------------------");
            System.out.println("Lines : " + totalLinesOfCode);	
        }
    }
}